<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Table 对象</title>
    <style>
    table {width:80%;margin:6% auto;border: 1px solid #aaa;border-collapse: collapse;}
    table td {border: 1px solid #aaa;padding: 6px 8px;}
    </style>
</head>
<body>

    <table id="myTable">
        <tr>
          <td>Row 1</td>
          <td><input type="button" value="删除" onclick="deleteRow(this)"></td>
      </tr>
      <tr>
          <td>Row 2</td>
          <td><input type="button" value="删除" onclick="deleteRow(this)"></td>
      </tr>
      <tr>
          <td>Row 3</td>
          <td><input type="button" value="删除" onclick="deleteRow(this)"></td>
      </tr>
  </table>

  <script type="text/javascript">
  function deleteRow(r)
  {
      var i=r.parentNode.parentNode.rowIndex;
      document.getElementById('myTable').deleteRow(i);
  }
  </script>
</body>
</html>
